import math
import numpy
from scipy.interpolate import LinearNDInterpolator
from ..dataclass.geoProfiles import MaterialTable, Profile1D
from ..dataclass.geoStructures import BasicCompositePile, BasicPile, BoredPile, ConcreteHollowPile, ConcreteSquarePile, FlexiblePile, PileType, PostGroutedPile, RigidPile, RockSocketedPile, SteelPipePile
from ..dataclass.terminologies import GeoMaterialProps, SoilTypes

from typing import Any, Optional, List, Dict, Tuple, Set, Union

profile: Any
pile: Any

class PileCapacityCal:
    """Calculate the bearing capacity of a pile."""
    def __init__(self, pile: Any, profile: Profile1D, material_table: MaterialTable) -> Any:
        ...
    def skin_capacity(self) -> dict[str, Any]:
        """
        Calculate the skin capacity Q_{sk} of a pile.
        
        Returns
        -------
        dict[str, float | list[float]]
            The skin capacity Q_{sk} of a pile. Here are the keys:
            - "total": the total skin capacity of the pile.
            - "per_layer": the skin friction of each layer.
            - "material_id": the material id of each layer.
            - "thickness": the thickness of each layer.
            - "beta_si": the factor related to pile skin grouting - only available for post-grouted-pile.
        """
        ...
    def base_capacity(self) -> dict[str, Any]:
        """
        Calculate the base capacity Q_{pk} of a pile.
        
        Returns
        -------
        dict[str, float | int]
            The base capacity Q_{pk} of a pile. Here are the keys:
            - "total": the total base capacity of the pile.
            - "base_resistance": the base resistance of the base layer.
            - "material_id": the material id of base layer.
            - "beta_p": the factor related to pile base grouting - only available for post-grouted-pile
            - "lambda_p": the factor related to pile base blocking - only available for steel pipe pile and concrete hollow pile.
            - "net_area": the area of the base - only available for concrete hollow pile.
            - "open_area": the area of the open part of the base - only available for concrete hollow pile.
            - "thickness": the thickness of the base layer - only available for rock socketed pile.
        """
        ...
    def total_capacity(self) -> float:
        """Calculate the total capacity Q_{uk} = Q_{sk} + Q_{pk} of a pile."""
        ...

class CompositePileCapacityCal:
    """Calculate the capacity of a composite pile."""
    def __init__(self, pile: BasicCompositePile, profile: Any = None, material_table: Any = None) -> Any:
        """
        Parameters
        ----------
        pile: BasicCompositePile
            The pile to calculate the capacity.
        profile: Profile1D | None, default: None
            The profile of the pile. It's necessary for calculating the capacity of a rigid pile.
        material_table: MaterialTable | None, default: None
            The material table of the pile. It's necessary for calculating the capacity of a rigid pile.
        """
        ...
    def flexible_pile_capacity(self) -> dict[str, float]:
        """
        Calculate the capacity of a flexible pile.
        
        Returns
        -------
        dict[str, float]
            The capacity of a flexible pile. Here are the keys:
            - "total": the total capacity of the pile (kPa), 复合地基承载力特征值
            - "area_replace_ratio": the replacement ratio of the composite area, 面积置换率
        """
        ...
    def rigid_pile_capacity(self) -> dict[str, float]:
        """
        Calculate the capacity of a rigid pile.
        
        Returns
        -------
        dict[str, float]
            The capacity of a rigid pile. Here are the keys:
            - "total": the total capacity of the pile (kPa), 复合地基承载力特征值 kPa
            - "single_pile": the capacity of a single pile (kN), 单桩竖向承载力特征值 kN
            - "base_soil": the material id of the base soil. 桩端持力层材料ID
        """
        ...
